package org.monster.boot;

import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;

/**
 * 管道连接器
 * {@link DosSender}和{@link DosReceiver}通信连接器类
 *
 * @author Monster
 */
public class PipedConnector {

    /**
     * 链接
     * {@link DosSender}和{@link DosReceiver}的连接方法
     *
     * @param dosReceiver {@link DosSender}
     * @param dosSender   {@link DosReceiver}
     * @throws java.io.IOException
     */
    public void connect(DosReceiver dosReceiver, DosSender dosSender)
            throws IOException {
        PipedOutputStream pipedOut = dosSender.getPipedOut();
        PipedInputStream pipedIn = dosReceiver.getPipedIn();
        pipedOut.connect(pipedIn);
    }

}
